#ifndef DATA_READER_H
#define DATA_READER_H

#include <string>
#include <vector>

using std::string;
using std::vector;

// An representation of an image.  An image consists of a grid of pixel values.
class Image {
 public:
  Image(int label)
    : label_(label) {
  }

  void Print();

  // The 14x14 grid of pixel values for the image.
  vector<vector<int> > pixels_;
  // The image label.
  int label_;
};

class DataReader {
 public:
  // Retrieves images from filename.  If limit == -1, then all images are retrieved.  If limit > 0,
  // then we read the first limit images from filename.
  static vector<Image*> GetImages(const string& filename, int limit = -1);

  // Dumps the weight vector to filename.
  static void DumpWeights(const vector<double>& weights, const string& filename);

  // Reads a vector of weights from filename.
  static vector<double> ReadWeights(const string& filename);
};

#endif
